const { Service } = require('ee-core');
const Storage = require('ee-core/storage'); 

class CameraService extends Service {
  constructor(ctx) {
    super(ctx);
    this.cameraDB = Storage.connection('camera', jsondbOptions = {
      driver: 'jsondb'
    });  
  }

  async getAllTestData() {
    const key = this.demoDBKey.test_data;
    if (!this.cameraDB.db.has(key).value()) {
      this.cameraDB.db.set(key, []).write();
    }
    let data = this.cameraDB.db
      .get(key)
      .value();
    
    if (_.isEmpty(data)) {
      data = []
    }
    
    return data;
  }

}